home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / FWTxtBox.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.4 KB  |  154 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWTxtBox.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9. //
  10. //    Class Definitions for
  11. //            - FW_CTextBoxShape
  12. //
  13.  
  14. #ifndef FWTXTBOX_H
  15. #define FWTXTBOX_H
  16.  
  17. #ifndef FWBTXTSH_H
  18. #include "FWBTxtSh.h"
  19. #endif
  20.  
  21. //========================================================================================
  22. //    class FW_CTextBoxShape
  23. //========================================================================================
  24.  
  25. class FW_CTextBoxShape : public FW_CBaseTextShape
  26. {
  27. public:
  28.     FW_DECLARE_CLASS
  29.     FW_DECLARE_AUTO(FW_CTextBoxShape)
  30.  
  31. //----------------------------------------------------------------------------------------
  32. //    Constructors/Destructors
  33. //
  34. public:
  35.  
  36.     enum
  37.     {
  38.         kDefaultJustification =
  39.             FW_kTextBoxJustifyLeft |
  40.             FW_kTextBoxJustifyTop |
  41.             FW_kTextBoxWordWrap |
  42.             FW_kTextBoxClipToBox
  43.     };
  44.  
  45.     FW_CTextBoxShape();
  46.  
  47.     FW_CTextBoxShape(const FW_CString& string, 
  48.                     const FW_CRect& box,
  49.                     const FW_CFont& font = FW_kNormalFont,
  50.                     FW_TextBoxOptions options = kDefaultJustification,
  51.                     const FW_CInk& ink = FW_kNormalTextInk);
  52.  
  53.     FW_CTextBoxShape(FW_CTextReader& textReader, 
  54.                     const FW_CRect& box,
  55.                     const FW_CFont& font = FW_kNormalFont,
  56.                     FW_TextBoxOptions options = kDefaultJustification,
  57.                     const FW_CInk& ink = FW_kNormalTextInk);
  58.                     
  59.     FW_CTextBoxShape(const FW_CTextBoxShape& other);
  60.     FW_CTextBoxShape(FW_CReadableStream& stream);
  61.     
  62.     virtual ~ FW_CTextBoxShape();
  63.     
  64. //----------------------------------------------------------------------------------------
  65. //    Operators
  66. //
  67. public:
  68.     FW_CTextBoxShape& operator=(const FW_CTextBoxShape& other);
  69.     
  70. //----------------------------------------------------------------------------------------
  71. //    Inherited API
  72. //
  73. public:
  74.     // ----- Rendering -----
  75.     virtual void                 Render(FW_CGraphicContext& gc) const;
  76.                             
  77.     // ----- Transform -----
  78.     virtual void                Transform(Environment* ev, ODTransform* odTransform);
  79.     virtual void                InverseTransform(Environment* ev, ODTransform* odTransform);
  80.  
  81.     virtual void                MoveShape(FW_Fixed deltaX, FW_Fixed deltaY);
  82.     virtual void                MoveShapeTo(FW_Fixed x, FW_Fixed y);
  83.  
  84.     virtual void                Inset(FW_Fixed x, FW_Fixed y);
  85.     
  86.     // ----- Copying -----
  87.     virtual FW_CShape*            Copy() const;
  88.     
  89.     // ----- Geometry -----
  90.     virtual void                 GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const;
  91.  
  92.     // ----- Anchor Point -----
  93.     virtual FW_CPoint            GetAnchorPoint() const;
  94.     
  95.     // ----- Flatten -----
  96.     virtual void                Flatten(FW_CWritableStream& stream) const;
  97.  
  98. //----------------------------------------------------------------------------------------
  99. //    New API
  100. //
  101. public:
  102.     // ----- Rendering -----                            
  103.     static FW_Fixed                RenderTextBox(FW_CGraphicContext& gc, 
  104.                                                   FW_CTextReader& textReader, 
  105.                                                 const FW_CRect& box,
  106.                                                   const FW_CFont& font,
  107.                                                 FW_TextBoxOptions options = kDefaultJustification,
  108.                                                   const FW_CInk& ink = FW_kNormalTextInk);
  109.  
  110.     static FW_Fixed                RenderTextBox(FW_CGraphicContext& gc, 
  111.                                                   const FW_CString& string, 
  112.                                                 const FW_CRect& box,
  113.                                                   const FW_CFont& font,
  114.                                                 FW_TextBoxOptions options = kDefaultJustification,
  115.                                                   const FW_CInk& ink = FW_kNormalTextInk);
  116.  
  117.     // ----- Archiving -----
  118.     static void*                 Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  119.  
  120.     // ----- Measurement -----
  121.     void                        UpdateTextBox(FW_CGraphicContext& gc);
  122.     
  123.     static void                    CalcTextBox(FW_CGraphicContext& gc,
  124.                                               FW_CTextReader& textReader, 
  125.                                             FW_TextBoxOptions options,
  126.                                               const FW_CFont& font,
  127.                                             FW_CRect& box);
  128.     static void                    CalcTextBox(FW_CGraphicContext& gc, 
  129.                                               const FW_CString& string, 
  130.                                             FW_TextBoxOptions options,
  131.                                               const FW_CFont& font,
  132.                                             FW_CRect& box);
  133.     
  134.     // ----- Getters/Setters -----
  135.     void                        GetTextBox(FW_CRect& textBox) const
  136.                                     {textBox = fTextBox;}
  137.     void                        SetTextBox(const FW_CRect& textBox)
  138.                                     {fTextBox = textBox;}
  139.  
  140.     FW_TextBoxOptions            GetOptions() const
  141.                                     {return fOptions;}
  142.     void                        SetOptions(FW_TextBoxOptions options)
  143.                                     {fOptions = options;}
  144.  
  145. //----------------------------------------------------------------------------------------
  146. //    Data Members
  147. //
  148. protected:
  149.     FW_CRect                fTextBox;
  150.     FW_TextBoxOptions        fOptions;
  151. };
  152.  
  153. #endif
  154.